package com.googlecode.pathmachine.nn;

/**
 *Name: Genome
 *
 *Author: John Pendlebury ported to Java from code written by Matt Buckland
 *
 *Description: Represents a specific group of genes.
 *
 *You can reuse this code provided you include these comments.
 *I'd also appreciate you letting me know via email just because I'm
 *interested.
 *
 *email: john.pendlebury2@mail.dcu.ie
 */
import java.util.*;

public class Genome implements Comparable
{
	private List<Double> genes;
	private double fitness=0;

	public Genome()
	{
		genes = new ArrayList<Double>();
	}

	public Genome(List<Double> genes, double fitness)
	{
		this.genes=genes;
		this.fitness=fitness;
	}
	
	public double getFitness()
	{
		return fitness;
	}
	
	public List<Double> getGenes()
	{
		return genes;
	}
	
	public void addGene(double gene)
	{
		genes.add(gene);
	}
	
	public int compareTo(Object object)
	{
		Genome genome = (Genome)object;
        if(this.fitness < genome.fitness)
        	return -1;
        
        if(this.fitness > genome.fitness)
        	return 1;
        
        return 0;
    }
	
	public void setFitness(double fitness)
	{
		this.fitness=fitness;
	}
}
